﻿<%@ Page Title="" Language="VB" MasterPageFile="~/masterpages/Main.master" AutoEventWireup="false" CodeFile="upload.aspx.vb" Inherits="admin_photogallery_addPhoto" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">

    <script type="text/javascript">
function addFileUploadBox()
    {
        if(!document.getElementById || !document.createElement)
        {
            return false;
        } 
        
        var uploadArea = document.getElementById("UploadField");
        if(!uploadArea)
        {
            return;
        }        
        
        var newLine = document.createElement("br");
        uploadArea.appendChild(newLine);
        var newLine2 = document.createElement("br");
        uploadArea.appendChild(newLine2);
        var newLine3 = document.createElement("br");
        uploadArea.appendChild(newLine3);
        var newLine4 = document.createElement("br");
        uploadArea.appendChild(newLine4);
        var newLine5 = document.createElement("br");
        uploadArea.appendChild(newLine5);
        
        // Create Title Box
        var newNameBox = document.createElement("input");
        newNameBox.type = "text";
        
        if(!addFileUploadBox.lastAssignedId)
        {
            addFileUploadBox.lastAssignedId = 1;
        }
        
        newNameBox.setAttribute("id", "txtImgName" + addFileUploadBox.lastAssignedId)
        newNameBox.setAttribute("name", "txtImgName" + addFileUploadBox.lastAssignedId)
        newNameBox.setAttribute("class", "adminTxtBox")
        // Create Title Label
        var newNameBoxLbl = document.createElement("label");
        
        if(!addFileUploadBox.lastAssignedId)
        {
            addFileUploadBox.lastAssignedId = 1;
        }
        
        newNameBoxLbl.setAttribute("id", "lblImgName" + addFileUploadBox.lastAssignedId)
        newNameBoxLbl.setAttribute("name", "lblImgName" + addFileUploadBox.lastAssignedId)
        newNameBoxLbl.setAttribute("style", "width: 120px; display: block; float: left;" + addFileUploadBox.lastAssignedId)
        // Create Caption box
        var newCapBox = document.createElement("input");
        newCapBox.type = "text";
        
        if(!addFileUploadBox.lastAssignedId)
        {
            addFileUploadBox.lastAssignedId = 1;
        }
        
        newCapBox.setAttribute("id", "txtCaption" + addFileUploadBox.lastAssignedId)
        newCapBox.setAttribute("name", "txtCaption" + addFileUploadBox.lastAssignedId)
        newCapBox.setAttribute("class", "adminTxtBox")
        
        // Create Caption Label
        var newCapBoxLbl = document.createElement("label");
        
        if(!addFileUploadBox.lastAssignedId)
        {
            addFileUploadBox.lastAssignedId = 1;
        }
        
        newCapBoxLbl.setAttribute("id", "lblCap" + addFileUploadBox.lastAssignedId)
        newCapBoxLbl.setAttribute("name", "lblCap" + addFileUploadBox.lastAssignedId)
        newCapBoxLbl.setAttribute("style", "width: 120px; display: block; float: left;" + addFileUploadBox.lastAssignedId)
        // Create Upload Box
        var newUploadBox = document.createElement("input");
        newUploadBox.type = "file";
        
        if(!addFileUploadBox.lastAssignedId)
        {
            addFileUploadBox.lastAssignedId = 1;
        }
        
        newUploadBox.setAttribute("id", "UploadFile" + addFileUploadBox.lastAssignedId)
        newUploadBox.setAttribute("name", "UploadFile" + addFileUploadBox.lastAssignedId)
        newUploadBox.setAttribute("class", "adminTxtBox")

        // Create File Label
        var newUploadBoxLbl = document.createElement("label");
        
        if(!addFileUploadBox.lastAssignedId)
        {
            addFileUploadBox.lastAssignedId = 1;
        }
        
        newUploadBoxLbl.setAttribute("id", "lblFile" + addFileUploadBox.lastAssignedId)
        newUploadBoxLbl.setAttribute("name", "lblFile" + addFileUploadBox.lastAssignedId)
        newUploadBoxLbl.setAttribute("style", "width: 120px; display: block; float: left;" + addFileUploadBox.lastAssignedId)

        uploadArea.appendChild(newNameBoxLbl);
        uploadArea.appendChild(newNameBox);
        uploadArea.appendChild(newLine2);
        
        uploadArea.appendChild(newCapBoxLbl);
        uploadArea.appendChild(newCapBox);
        uploadArea.appendChild(newLine3);

        uploadArea.appendChild(newUploadBoxLbl);
        uploadArea.appendChild(newUploadBox);
        uploadArea.appendChild(newLine4);

        document.getElementById("lblImgName" + addFileUploadBox.lastAssignedId).innerHTML = "Image Name: ";
        document.getElementById("lblCap" + addFileUploadBox.lastAssignedId).innerHTML = "Caption: ";
        document.getElementById("lblFile" + addFileUploadBox.lastAssignedId).innerHTML = "Select File To Upload: ";
        
        addFileUploadBox.lastAssignedId++;
                
    }
 
</script>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <div class="fullContent">
    <h2>Photogallery Admin</h2>
<h3>Add Photo</h3>

        <p><asp:Label ID="lblMessage" runat="server" /></p>
    <asp:Panel ID="pnlNewImage" runat="server">
         <input type="button" id="buttonAdd" value="Add a File" onclick="addFileUploadBox();" /><br />
    </asp:Panel>
    <div id="UploadField">
        <div class="formRow">
            <span class="formField">
                <label for="txtImgName">Photo name:</label>
             </span>
            <asp:TextBox ID="txtImgName" runat="server" CssClass="adminTxtBox" />
        </div>
        
        
        
        <div class="formRow">
            <span class="formField">
                <label for="txtCaption">Caption:</label>
             </span>
            <asp:TextBox ID="txtCaption" runat="server" CssClass="adminTxtBox" />
        </div>
        
        <div class="formRow">
            <span class="formField">
                <label for="txtCaption">File:</label>
             </span>
            <asp:FileUpload ID="fuPhoto" runat="server" CssClass="adminTxtBox" />
        </div>
        </div>
        
       
        <div class="formRow">
            <span class="formField">
                <label for="Submit">
                    &nbsp;</label></span>
            <asp:ImageButton ID="btnSubmit" runat="server" ImageUrl="/img/submit.gif" />
        </div>

        <div class="formRow">
            <span class="formField">
            <asp:Label ID="Label1" runat="server" /></span>
        </div>    
            <asp:Label ID="lblFileUpload" runat="server" /><br />
            <asp:Label ID="lblImgName" runat="server" /><br />
            <asp:Label ID="lblImgCap" runat="server" /><br />
    
    <asp:Label ID="lblFileUpload2" runat="server" /><br />
    <asp:Label ID="lblImgName2" runat="server" /><br />
    <asp:Label ID="lblImgCap2" runat="server" /><br />
    <asp:PlaceHolder ID="placeHolder" runat="server" />
        <a href="default.aspx">Photo Admin Home</a>
        



</div>
</asp:Content>

